# tests/test_tables.py
from core.extractor import LineageExtractor

def test_simple_insert_select():
    sql = """
    INSERT INTO sales_summary (region, total)
    SELECT region, SUM(amount) FROM sales GROUP BY region;
    """
    res = LineageExtractor().extract(sql)
    st = res.statements[0]
    assert "sales" in st.source_tables
    assert "sales_summary" in st.target_tables
    assert st.op in ("INSERT", "INSERT INTO", "UNKNOWN", "SELECT")  # 允许方言差异
